Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from netdata:master #372

Merged
merged 6 commits into from
Feb 18, 2025
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Feb 18, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

This pull request refactors the dyncfg job management to remove file locking, adds logging for dyncfg actions, and fixes a bug in the k8s_state collector. It also disables the sensors collector by default.

Bug Fixes:

  • Fixes a bug in the k8s_state collector where the condition_available metric was incorrectly assigned the value of condition_progressing.
  • Fixes a bug where the sensors collector was not disabled by default.

Enhancements:

  • Adds logging of dyncfg actions, including the user who initiated the action.
  • Removes file locking for dyncfg jobs, simplifying the code and removing potential deadlocks.

Chores:

  • Removes the lock_dir configuration option and related code, as file locking is no longer used.

@pull pull bot added the ⤵️ pull label Feb 18, 2025
Copy link

sourcery-ai bot commented Feb 18, 2025

Reviewer's Guide by Sourcery

This pull request removes the file locking mechanism, enhances logging for dyncfg operations, updates the k8s_state collector test, and disables the sensors collector by default.

Sequence diagram for dyncfgConfigAdd

sequenceDiagram
    participant Manager
    participant functions.Function as Function
    participant confgroup.Config as Config
    Manager->>Manager: m.dyncfgSetConfigMeta(cfg, mn, jn, fn)
    Manager->>Manager: m.createCollectorJob(cfg)
    alt ecfg exists
        Manager->>Manager: m.exposedConfigs.lookup(cfg)
        alt scfg exists and isDyncfg
            Manager->>Manager: m.seenConfigs.lookup(ecfg.cfg)
            Manager->>Manager: m.seenConfigs.remove(ecfg.cfg)
        end
    end
    Manager->>Manager: m.exposedConfigs.add(cfg)
    Manager->>Manager: m.seenConfigs.add(cfg)
    Manager->>Manager: m.dyncfgRespf(fn, 200, "")
    Manager->>Manager: m.dyncfgJobStatus(cfg, dyncfgAccepted)
Loading

Sequence diagram for dyncfgConfigRemove

sequenceDiagram
    participant Manager
    participant functions.Function as Function
    participant ExposedConfig as Ecfg
    Manager->>Manager: m.exposedConfigs.lookupByName(mn, jn)
    Manager->>Manager: m.seenConfigs.remove(ecfg.cfg)
    Manager->>Manager: m.exposedConfigs.remove(ecfg.cfg)
    Manager->>Manager: m.stopRunningJob(ecfg.cfg.FullName())
    Manager->>Manager: m.FileStatus.Remove(ecfg.cfg)
    Manager->>Manager: m.dyncfgRespf(fn, 200, "")
    Manager->>Manager: m.dyncfgJobStatus(ecfg.cfg, dyncfgRemoved)
Loading

Sequence diagram for dyncfgConfigUpdate

sequenceDiagram
    participant Manager
    participant functions.Function as Function
    participant confgroup.Config as Config
    Manager->>Manager: m.dyncfgSetConfigMeta(cfg, mn, jn, fn)
    alt ecfg.status == dyncfgRunning && ecfg.cfg.UID() == cfg.UID()
        Manager->>Manager: m.dyncfgRespf(fn, 200, "")
        Manager->>Manager: m.dyncfgJobStatus(ecfg.cfg, ecfg.status)
    else
        Manager->>Manager: m.exposedConfigs.lookupByName(mn, jn)
        Manager->>Manager: m.stopRunningJob(ecfg.cfg.FullName())
        Manager->>Manager: m.exposedConfigs.remove(ecfg.cfg)
        Manager->>Manager: m.createCollectorJob(cfg)
        alt scfg exists
            Manager->>Manager: m.seenConfigs.lookup(cfg)
            Manager->>Manager: m.startRunningJob(job)
            Manager->>Manager: m.dyncfgRespf(fn, 200, "")
            Manager->>Manager: m.dyncfgJobStatus(scfg.cfg, scfg.status)
        else
            Manager->>Manager: m.dyncfgRespf(fn, 500, "Job update failed: cannot find config.")
            Manager->>Manager: m.dyncfgJobStatus(scfg.cfg, scfg.status)
        end
    end
Loading

Updated class diagram for Agent and Manager

classDiagram
  class Agent {
    -ServiceDiscoveryConfigDir
    -CollectorsConfigWatchPath
    -StateFile
    -RunModule
    -MinUpdateEvery
    -ModuleRegistry
    -ConfigDefaults
    -runningJobs
    -modules
    +New(Config) *Agent
    +Run(context.Context)
  }
  class Config {
    -CollectorsConfigWatchPath
    -ServiceDiscoveryConfigDir
    -StateFile
    -ModuleRegistry
    -RunModule
    -MinUpdateEvery
  }
  class Manager {
    -Modules
    -ConfigDefaults
    -FileStatus
    -FileStatusStore
    -FnReg
    -Vnodes
    -exposedConfigs
    -seenConfigs
    -runningJobs
    -ctx
    -cancel
    -Out
    +New() *Manager
    +Run(context.Context)
    +addConfig(confgroup.Config)
    +removeConfig(confgroup.Config)
    +cleanup()
  }

  Agent -- Config : uses
  Agent -- Manager : uses
Loading

File-Level Changes

Change Details Files
The NETDATA_LOCK_DIR environment variable and related functionality have been removed.
  • Removed NETDATA_LOCK_DIR from environment variables.
  • Removed the lock directory configuration option.
  • Removed file locking mechanisms from the go.d plugin.
  • Removed the FileLocker interface.
src/go/plugin/go.d/agent/jobmgr/dyncfg_collector.go
src/go/plugin/go.d/agent/agent.go
src/go/plugin/go.d/agent/jobmgr/di.go
src/go/cmd/godplugin/config.go
src/go/plugin/go.d/agent/jobmgr/manager.go
src/daemon/daemon.c
src/daemon/buildinfo.c
src/daemon/common.h
src/daemon/config/netdata-conf-directories.c
src/daemon/environment.c
src/daemon/h2o-common.c
src/go/cmd/godplugin/main.go
Enhanced logging for dyncfg operations to include the user who initiated the action.
  • Added logging statements to include the user when testing dyncfg configurations.
  • Added logging statements to include the user when retrieving dyncfg schema.
  • Added logging statements to include the user when retrieving dyncfg configurations.
  • Added logging statements to include the user when restarting dyncfg configurations.
  • Added logging statements to include the user when enabling dyncfg configurations.
  • Added logging statements to include the user when disabling dyncfg configurations.
  • Added logging statements to include the user when adding dyncfg configurations.
  • Added logging statements to include the user when removing dyncfg configurations.
  • Added logging statements to include the user when updating dyncfg configurations.
  • Modified the dyncfg config metadata to include user information.
  • Modified the dyncfg vnode config to include user information.
  • Added helper function to extract source values from function arguments.
src/go/plugin/go.d/agent/jobmgr/dyncfg_collector.go
src/go/plugin/go.d/agent/jobmgr/dyncfg_vnode.go
src/go/plugin/go.d/agent/jobmgr/dyncfg.go
Updated k8s_state collector test to assert on additional deployment conditions.
  • Added assertions for DeploymentProgressing condition.
  • Added assertions for DeploymentReplicaFailure condition.
  • Set Status to corev1.ConditionTrue for DeploymentProgressing condition.
  • Set Status to corev1.ConditionTrue for DeploymentReplicaFailure condition.
src/go/plugin/go.d/collector/k8s_state/collector_test.go
src/go/plugin/go.d/collector/k8s_state/collect.go
Disabled the sensors collector by default.
  • Set Disabled to true in the sensors collector defaults.
src/go/plugin/go.d/collector/sensors/collector.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@pull pull bot merged commit 2318138 into webfutureiorepo:master Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant